package org.nacos.provider.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.nacos.provider.annotation.CheckNum;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.validation.groups.Default;


@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ProductDTO4 {

	@CheckNum
	private Integer id;

	@NotNull(message = "产品名称不能为空", groups = Update.class)
	@NotBlank(message = "长度必须大于0", groups = {Add.class, Update.class})
	private String name;

	@CheckNum(value = 1, message = "产品数量不等于10", groups = Update.class)
	private Integer prodCount;

	@Size(min = 5, max = 10, message = "请输入5-10个字符的描述")
	private String desc;

	// 如果说某个校验项没有指定分组，默认属于 Default 分组
	// 分组之间可以继承，A extends B，那么 A 中拥有 B 中所有的校验项
	public interface Add extends Default {

	}

	public interface Update extends Default {

	}

}
